OLE.CREATE Function
Syntax
P Create(C ProgId[,P eventHandler])
Arguments
- ProgId
The identifier for the OLE object that you wish to use.
- eventHandler
Pointer
Description
Create an OLE automation object.
Discussion
The OLE.CREATE method creates a new OLE automation object. Ole.create can take an optional event handler as either a class with a EventHandler implementation, or a code block with event methods.
Examples
This script opens a Microsoft Word template (.dot) and saves the file to a Microsoft Word document(.doc). The usage is usage is Word_Conv_Document("c:\document.dot","C:\document.doc").
FUNCTION Word_Conv_Document as L (docName as C , NewDoc as C)
Dim wordApp as P
Dim wordDoc as P
wordApp = ole.Create("Word.Application")
wordApp.WindowState = 1 'wdWindowStateMaximize
wordApp.Documents.Open(docname)
wordApp.ActiveDocument.SaveAs(NewDoc,0) ' 0 is a Word Document ' 4 is a text file
WordApp.Quit()
Word_Conv_Document = .T.
delete wordDoc
delete wordApp
END FUNCTIONDim WB as P
Dim OldText as C
Dim NewText as C
Dim I as N
Dim CH as C
NewText = ""
WB = ole.Create("Word.Basic")
WB.FileNew()
WB.Insert("Ths iz pur splling fur sore!")
WB.ToolsSpelling()
WB.EditSelectAll()
OldText = WB.selection()
WB.FileExit(2)
delete WB
ui_dlg_box("Corrected","{text=50,5:oldtext}")
ui_modeless_dlg_setfocus("corrected")See Also